package com.gitee;

/**
 * @author Administrator
 * @date 2020/9/9
 * @Description: TODO
 */
public class ExcelUtils {

    /**
     * 根据索引获取EXCEL定位符
     * @param columnIndex
     * @param rowIndex
     * @return
     */
    public static String excelColIndexToStr(int columnIndex,int rowIndex) {
        if (columnIndex < 0) {
            return null;
        }
        String columnStr = "";
        rowIndex++;
        do {
            if (columnStr.length() > 0) {
                columnIndex--;
            }
            columnStr = ((char) (columnIndex % 26 + (int) 'A')) + columnStr;
            columnIndex = ((columnIndex - columnIndex % 26) / 26);
        } while (columnIndex > 0);
        return columnStr + rowIndex;
    }
}
